<template>
    <div class="activity">
        <p>
            <img src="../assets/images/activity-01.png" alt="">
        </p>
        <p class="tobuy">
            <img src="../assets/images/activity-02.png" alt="">
            <a href="javascript:void(0);" @click="openApp"></a>
        </p>
        <p>
            <img src="../assets/images/activity-03.png" alt="">
        </p>
        <p class="download">
            <img src="../assets/images/activity-04.png" alt="">
            <a href="javascript:void(0);" @click="openGft"></a>
        </p>
        <p>
            <img src="../assets/images/activity-05.png" alt="">
        </p>
        <open-app ref="openApp"></open-app>
    </div>
</template>
<script>
import openApp from './OpenApp'
export default {
    name: "yjgActivity",
    data() {
        return {
            gid: 'e6c4328e-4b52-4765-806f-a93592bac0ae',
            storeId: 'f45932bb-9412-4f77-9706-8f7a1e9dfbd8',
            iosUrl: 'https://itunes.apple.com/us/app/%E9%9B%84%E9%9B%84%E8%BD%A6/id1303439351?l=zh&ls=1&mt=8',
            androidUrl: 'http://images.autobro.cn/app/xxc.apk',
            downLink: ''
        }
    },
    components: {
        openApp
    },
    created() {
        if (navigator.userAgent.match(/android/i)) {
            this.downLink = this.androidUrl
        } else if (navigator.userAgent.match(/(iPhone|iPod|iPad);?/i)) {
            this.downLink = this.iosUrl
        }
    },
    methods: {
        openApp() {
            //this.$route.query.gid 
            let gid = this.$route.query.gid || this.gid
            let storeId = this.$route.query.storeId || this.storeId
            this.$refs.openApp.openApp([{ '': 'productUID', 'value': gid }, { 'field': 'salesOutletUID', 'value': storeId }], "yjgActivity", false);
        },
        openGft() {
            //console.log('this.downLink:', this.downLink)
            //this.$refs.openApp.openApp()
            window.location.href = this.downLink
        }
    }

}
</script>
 <style scoped>
.activity {
    width: 10rem;
    margin: 0 auto;
    background: #3a1a63;
}

.activity p {
    position: relative;
}

.activity p.tobuy a {
    position: absolute;
    top: 7.6rem;
    right: 0.84rem;
    width: 3.92rem;
    height: 0.96rem;
}

.activity p.download a {
    position: absolute;
    top: 7.64rem;
    right: 2.5333rem;
    width: 2rem;
    height: 0.7333rem;
}

img {
    width: 100%;
    height: auto;
    display: block;
    vertical-align: middle;
}
</style>

